/*
 * @Author: Jimmy
 * @LastModifiedBy: Jimmy
 * @Date: 2024-05-25 17:43:18
 * @LastEditTime: 2024-05-25 18:56:26
 * @FilePath: /nest_study/src/common/entites/base.ts
 */
import { ApiProperty } from "@nestjs/swagger";
import { Column, CreateDateColumn, Entity, UpdateDateColumn } from "typeorm";
import { SYS_DEL_FLAG, SYS_STATUS } from "../enum/status";

@Entity()
export abstract class BaseEntity {
    // 0正常 1 停用
    @ApiProperty({ type: Number, description: '状态 0正常 1 停用' })
    @Column({
        type: "varchar",
        name: 'status',
        default: SYS_STATUS.COMMON,
        comment: '状态'
    })
    public status: string

    //0存在 1删除
    @ApiProperty({ type: Number, description: '删除标识 0存在 1删除' })
    @Column({
        type: "varchar",
        name: 'del_flag',
        default: SYS_DEL_FLAG.EXIST,
        comment: '删除标识'
    })
    public delFlag: string

    @ApiProperty({ type: String, description: '创建者' })
    @Column({ type: 'varchar', name: 'create_by', length: 64, default: '', comment: '创建者' })
    public createBy: string;

    @ApiProperty({ type: Date, description: '创建时间' })
    @CreateDateColumn({ type: 'timestamp', name: 'create_time', comment: '创建时间' })
    public createTime: Date;

    @ApiProperty({ type: String, description: '更新者' })
    @Column({ type: 'varchar', name: 'update_by', length: 64, default: '', comment: '更新者' })
    public updateBy: string;

    @ApiProperty({ type: Date, description: '更新时间' })
    @UpdateDateColumn({ type: 'timestamp', name: 'update_time', comment: '更新时间' })
    public updateTime: Date;

    @ApiProperty({ type: String, description: '备注' })
    @Column({ type: 'varchar', name: 'remark', length: 500, default: '', comment: '备注' })
    public remark: string;

}